#include<stdlib.h>
#include<stdio.h>

int get_ones_1(unsigned short b){
    int res,count = 0;
    while(b){
        res = b%2;
        if(res)
            count++;
        b = (b-res)/2;
    }
    return count;
}

int get_ones_2(unsigned short b){
    int num = 0;
    while(b){
        num += b & 0x01;
        b = b >> 1;
    }
    return num;
}

int get_ones(unsigned short b){
    int num=0;
    while(b){
        b &= (b-1);
        num++;
    }
    return num;
}

int main(){
    unsigned short b = 127;
    printf("%d\n",get_ones(b));
    return 0;
}
